using System;
using System.Diagnostics;

namespace Dida
{
	public abstract class Sensor
	{
		private Pawn owner;

		internal void SetOwner(Pawn owner)
		{
			Debug.Assert(!(this.owner != null && owner != null),
				"You can't add a sensor that's already added to a pawn " + 
				"to another pawn (or the same pawn)");
			Debug.Assert(!(this.owner == null && this.owner == null),
				"A sensor can't be removed if it was never added");

			this.owner = owner;
		}

		public Pawn Owner
		{
			get 
			{
				Debug.Assert(owner != null, "This sensor hasn't been added to a pawn yet");
				return owner; 
			} 
		}

		public abstract void OnMotion(Vector3D start, Vector3D dir,
			float startTime, float endTime);
	}
}